<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>贝格智能资讯系统</title>
    <link rel="stylesheet" type="text/css" href="css/css.css" />
    <script src="//cdn.bootcss.com/angular.js/1.5.6/angular.min.js"></script>
    <script src="tm.pagination.js"></script>
    <script src="//cdn.bootcss.com/angular-ui-bootstrap/0.13.0/ui-bootstrap-tpls.js"></script>
    <script type="text/javascript">
        /*<![CDATA[*/
        var app = angular.module('app', ['tm.pagination', 'ui.bootstrap']);
        app.controller('MainController', function ($rootScope, $scope, $modal, $http) {
            function getURL(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) return unescape(r[2]);
                return null;
            }
            _get();
            $scope.more = function(){
                _get( $scope.num+1);
            }
            $scope.total =0;
            function _get(num) {
                if(num ==null){
                    $scope.num = 1;
                }else{
                    $scope.num = num;
                }
                $http({
                    url: '/findArticleBySentenceId?sid='+getURL('sid'),
                    method: 'GET'
                }).success(function (data) {
                    $scope.articles=[];
                    $scope.total = data.length;
                    if(data.length > 0) {

                        var currTotal = $scope.num*10;
                        var resultTotal = currTotal> $scope.total? $scope.total:currTotal;
                        $scope.articles = [];
                        for(var i =0 ;i<resultTotal;i++){
                            $scope.articles.push(data[i]);
                        }


                    }
                });
                
            }

        });

    </script>
</head>
<body ng-app="app" ng-controller="MainController">
<div class="header">
    <h2><div class="url"><a href="indexs.html">回到首页</a></div></h2>
    <h1>猜你喜欢</h1>
</div>

<div class="container">
    <div class="list_li" >
        <div ng-repeat="article in articles">
        <dl>

            <dd>...
                <span ng-if="article.text.indexOf('<p>')>=0">{{article.text.substr(3)}}</span>
                <span ng-if="article.text.indexOf('<p>')<0">{{article.text}}</span>
                ...</dd>
            <dt><a href="detail.html?id={{article.aid}}">《{{article.tit}}》</a></dt>
        </dl>
        </div>
    </div>

</div>
<div class="page">
    <li><a ng-click="more()" ng-if="articles.length<total">查看更多</a></li>
</div>
</div>
<div class="back_top"><a href="javascript:scroll(0,0)"><img src="images/top.png"  /></a></div>
</body>
</html>
